<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>
<?php $this->load->view('common/head');?>

<?php $this->load->view('common/header');?>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <?php $this->load->view('common/sidebar');?>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <?php $this->load->view('common/breadcrumbs');?>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">

                <?php $this->load->view('common/set');?>

                <!-- /section:settings.box -->
                <div class="row">
                    <form class="form-inline" action="<?php echo site_url(X_URL.'member/search') ?>" method="post" id="form2">
                    <?php echo csrf_hidden();?>
                    
                        <label class="inline">用户搜索</label>
                        <select name="user" class="form-control" id="user">
                            <option value="">用户名</option>
                            
                        </select>
                        <input type="text" name="user_name" value="" class="form-control" id="user_name">

                        <label class="inline">&nbsp;&nbsp;排序：</label>
                        <select name="order" class="form-control">
                            <option  value="asc">注册时间升</option>
                            <option  value="desc">注册时间降</option>
                        </select>
                        <button type="submit" class="btn btn-purple btn-sm" id="submit">
                            <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                            查询
                        </button>
                        <span class="btn btn-purple btn-sm" id="adduser">
                            <span class="ace-icon fa fa-user icon-on-right bigger-110"></span>
                            新增用户
                        </span>
                    </form>

                    <div class="col-xs-12">

                        </div>
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                <th class="center">公司</th>
                                <th class="center">称呼/ 主体</th>
                                <th class="center">电话</th>
                                <th class="center">实名认证</th>
                                <th class="center">销售贷额度</th>
                                <th class="center">销售贷余额</th>
                                <th class="center">分期权限</th>
                                <th class="center">销售贷记录</th>
                                <th class="center">上次登陆</th>
                                <th class="center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if($users){ foreach ($users as $key => $val) { ?>
                                <tr>
                                    <td class="center">
                                        <input class="uids" type="checkbox" name="uids[]" value="{$val['uid']}">
                                    </td>
                                    <td class="center"><?php echo $val['user_company']; ?></td>
                                    <td class="center"><?php echo $val['user_uname'] ?? '--'; ?> / <?php echo $val['user_name'] ?? "--"; ?> </td>
                                    <td class="center"><?php echo $val['user_tel']; ?></td>
                                    <td class="center">
                                        <?php if($val['user_card_rz'] == 0){?>
                                            未认证
                                        <?php } ?>
                                        <?php if($val['user_card_rz'] == 1){?>
                                            <span class="label label-warning arrowed arrowed-right">待审核</span>
                                        <?php } ?>
                                        <?php if($val['user_card_rz'] == 2) {?>
                                            <span class="label label-success arrowed-in arrowed-in-right">已认证</span>
                                        <?php }?>
                                    </td>
                                    <td class="center"><?php echo $val['user_money']; ?></td>
                                    <td class="center"><?php echo $val['user_money_real']; ?></td>
                                    <td class="center"><?php echo $val['stage_num']; ?></td>
                                    <td class="center"><a href="<?php echo site_url(X_URL.'member/xiaoshoudai/'.$val['user_id']);?>">查看销售贷</a></td>
                                    <td class="center"><?php echo date("Y-m-d H:i",$val['user_logtime']); ?></td>
                                    <td class="center">
                                        <?php if($val['user_lock'] == 1){ ?>
                                            已冻结&nbsp;&nbsp;
                                            <a href="<?php echo site_url(X_URL.'member/frozen/'.$val['user_id']."/2");?>">解除冻结</a>&nbsp;&nbsp;
                                        <?php }else{ ?>
<!--                                            <a href="--><?php //echo site_url(X_URL.'member/edit_user/'.$val['user_id']);?><!--">修改</a>&nbsp;&nbsp;&nbsp;-->
                                            <a class="frozen" href="javascript:;" val="<?php echo site_url(X_URL.'member/frozen/'.$val['user_id']."/1");?>" title="冻结">冻结</a>
                                        <?php } ?>
                                        <?php if($val['user_card_rz'] == 1){?>
                                            <a href="<?php echo site_url(X_URL.'member/rz_user/'.$val['user_id']);?>">认证审核</a>&nbsp;&nbsp;
                                        <?php } ?>
                                        <?php if($val['user_card_rz'] == 2){?>
                                            <a href="<?php echo site_url(X_URL.'member/rz_user/'.$val['user_id']);?>">认证材料</a>&nbsp;&nbsp;
                                        <?php } ?>
                                        <?php if($val['user_card_rz'] == 2){?>
                                            <a href="<?php echo site_url(X_URL.'member/set_edu/'.$val['user_id']);?>">设置额度</a>&nbsp;&nbsp;
                                            <a href="<?php echo site_url(X_URL.'member/set_load/'.$val['user_id']);?>">设置分期权限</a>&nbsp;&nbsp;
                                        <?php } ?>
                                    </td>
                                </tr>
                            <?php } }?>
                            </tbody>
                        </table>
                        <?php if($pagination){?><ul class="pagination"><?php echo $pagination;?></ul><?php }?>
<!--                        {$page}-->
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
    </div><!-- /.main-content -->

<?php $this->load->view('common/footer');?>
</div><!-- /.main-container -->

<?php $this->load->view('common/footerjs');?>
<!-- inline scripts related to this page -->
<script type="text/javascript">

    $(function () {
        $("#officialnews ul").html('<div class="ace-icon fa fa-spinner fa-spin orange"></div>');
    })
    $("#adduser").click(function () {
        window.location.href="add";
    });
    $(".frozen").click(function () {
        var url = $(this).attr('val');
        bootbox.confirm({
            title: "系统提示",
            message: "确定冻结此用户吗?",
            callback: function (result) {
                if (result) {
                    window.location.href = url;
                }
            },
            buttons: {
                "cancel": {"label": "取消"},
                "confirm": {
                    "label": "确定",
                    "className": "btn-danger"
                }
            }
        });
    });
</script>
</body>
</html>
